home *** CD-ROM | disk | FTP | other *** search
- /*==================================================================
- File: MacZStringWindow.cp
-
- Contains: Primary window class for the Mac ZString tool
- (based on the PowerPlant framework)
-
- Written by: Eric Traut
-
- Copyright: 2000-2001 Connectix Corporation
-
- This source has been placed into the public domain by
- Connectix Corporation. You have the right to modify,
- distribute or use this code without any legal limitations
- or finanicial/licensing requirements. Connectix is not
- liable for any problems that result from the use of this
- code.
-
- If you have comments, feedback, questions, or would like
- to submit bug fixes or updates to this code, please email
- opensource@connectix.com.
- ==================================================================*/
-
- #include "MacZStringWindow.h"
- #include "FileIconPane.h"
- #include "FileSelectionGroupView.h"
-
- #include "ZStringTool.h"
- #include "MacZString.h"
-
- #include <LPopupButton.h>
- #include <LEditText.h>
- #include <LString.h>
- #include <LPushButton.h>
- #include <LStaticText.h>
- #include <LIconControl.h>
- #include <LCheckBox.h>
- #include <LRadioButton.h>
- #include <UStandardDialogs.h>
- #include <UClassicDialogs.h>
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <new>
-
- extern "C" {
- #include <FSp_fopen.h>
- }
-
-
-
- // ---------------------------------------------------------------------------
- // • MacZStringWindow Stream Constructor [public]
- // ---------------------------------------------------------------------------
-
- MacZStringWindow::MacZStringWindow(
- LStream * inStream)
- : LWindow(inStream),
- LListener()
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~MacZStringWindow Destructor [public]
- // ---------------------------------------------------------------------------
-
- MacZStringWindow::~MacZStringWindow()
- {
-
- }
-
-
- // ---------------------------------------------------------------------------
- // • FinishCreateSelf [private]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::FinishCreateSelf()
- {
- LWindow::FinishCreateSelf();
-
- RegisterWidgets();
- UpdateButtonStatus();
- }
-
-
- // ---------------------------------------------------------------------------
- // • RegisterWidgets [private]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::RegisterWidgets()
- {
- LPopupButton * popupButton;
- LPushButton * pushButton;
- FileSelectionGroupView * groupView;
-
- // Register the various controls that send messages
- popupButton = dynamic_cast<LPopupButton *>(FindPaneByID(pane_LanguagePopup));
- ThrowIfNULL_(popupButton);
- popupButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_ExtractButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_CompareButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_OverrideButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_QuitButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_SourceFileChooseButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_CompareFileChooseButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- pushButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_DestFileChooseButton));
- ThrowIfNULL_(pushButton);
- pushButton->AddListener(this);
-
- groupView = dynamic_cast<FileSelectionGroupView *>(FindPaneByID(pane_SourceGroupBox));
- ThrowIfNULL_(groupView);
- groupView->AddListener(this);
-
- groupView = dynamic_cast<FileSelectionGroupView *>(FindPaneByID(pane_CompareGroupBox));
- ThrowIfNULL_(groupView);
- groupView->AddListener(this);
-
- groupView = dynamic_cast<FileSelectionGroupView *>(FindPaneByID(pane_DestGroupBox));
- ThrowIfNULL_(groupView);
- groupView->AddListener(this);
- }
-
-
- // ---------------------------------------------------------------------------
- // • ListenToMessage [private]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::ListenToMessage(
- MessageT inMessage,
- void * ioParam)
- {
- switch (inMessage)
- {
- case pane_LanguagePopup:
- {
- // Update the resource text for for the selected language
- LStr255 resString;
-
- LPopupButton * popupButton = dynamic_cast<LPopupButton *>(FindPaneByID(pane_LanguagePopup));
- ThrowIfNULL_(popupButton);
-
- LEditText * editTextControl = dynamic_cast<LEditText *>(FindPaneByID(pane_LanguageResourceTextBox));
- ThrowIfNULL_(editTextControl);
-
- resString.Assign(popupButton->GetValue() + 127);
- editTextControl->SetText(resString);
- break;
- }
-
- case pane_ExtractButton:
- DoExtract();
- break;
-
- case pane_CompareButton:
- DoCompare();
- break;
-
- case pane_OverrideButton:
- DoCreateOverride();
- break;
-
- case pane_QuitButton:
- // Just send a synthetic quit command up to the app
- ObeyCommand(cmd_Quit, NULL);
- break;
-
- case pane_SourceFileChooseButton:
- SelectFile(pane_SourceFileNameStaticText, pane_SourceFileIcon, mSourceFileSpec, true);
- break;
-
- case pane_CompareFileChooseButton:
- SelectFile(pane_CompareFileNameStaticText, pane_CompareFileIcon, mCompareFileSpec, true);
- break;
-
- case pane_DestFileChooseButton:
- SelectFile(pane_DestFileNameStaticText, pane_DestFileIcon, mDestFileSpec, false);
- break;
-
- case pane_SourceGroupBox:
- SetFile(pane_SourceFileNameStaticText, pane_SourceFileIcon, *(FSSpec *)ioParam, mSourceFileSpec);
- break;
-
- case pane_CompareGroupBox:
- SetFile(pane_CompareFileNameStaticText, pane_CompareFileIcon, *(FSSpec *)ioParam, mCompareFileSpec);
- break;
-
- case pane_DestGroupBox:
- SetFile(pane_DestFileNameStaticText, pane_DestFileIcon, *(FSSpec *)ioParam, mDestFileSpec);
- break;
-
- default:
- break;
- }
- }
-
-
- // ---------------------------------------------------------------------------
- // • UpdateButtonStatus [private]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::UpdateButtonStatus()
- {
- LPushButton * extractButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_ExtractButton));
- ThrowIfNULL_(extractButton);
-
- LPushButton * compareButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_CompareButton));
- ThrowIfNULL_(compareButton);
-
- LPushButton * overrideButton = dynamic_cast<LPushButton *>(FindPaneByID(pane_OverrideButton));
- ThrowIfNULL_(overrideButton);
-
- // We can only extract & override if there is a source and dest
- if (mSourceFileSpec.IsValid() && mDestFileSpec.IsValid())
- {
- extractButton->Enable();
- overrideButton->Enable();
- }
- else
- {
- extractButton->Disable();
- overrideButton->Disable();
- }
-
- // We can only compare if there is also a compare file
- if (mSourceFileSpec.IsValid() && mDestFileSpec.IsValid() && mCompareFileSpec.IsValid())
- compareButton->Enable();
- else
- compareButton->Disable();
- }
-
-
- // ---------------------------------------------------------------------------
- // • GetUserOptions [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::GetUserOptions(
- ZToolOptions & outOptions)
- {
- // Read the user preferences.
- LCheckBox * checkBox;
- LRadioButton * radioButton;
-
- checkBox = dynamic_cast<LCheckBox *>(FindPaneByID(pane_AllowSemicolonCheckbox));
- ThrowIfNULL_(checkBox);
- outOptions.mAllowTagSemicolon = (checkBox->GetValue() != 0);
-
- checkBox = dynamic_cast<LCheckBox *>(FindPaneByID(pane_SortOutputCheckbox));
- ThrowIfNULL_(checkBox);
- outOptions.mCategorizeOutput = (checkBox->GetValue() != 0);
-
- checkBox = dynamic_cast<LCheckBox *>(FindPaneByID(pane_OutputDuplErrorCheckbox));
- ThrowIfNULL_(checkBox);
- outOptions.mFlagDuplicates = (checkBox->GetValue() != 0);
-
- checkBox = dynamic_cast<LCheckBox *>(FindPaneByID(pane_PrintWarningCheckbox));
- ThrowIfNULL_(checkBox);
- outOptions.mOutputWarnings = (checkBox->GetValue() != 0);
-
- checkBox = dynamic_cast<LCheckBox *>(FindPaneByID(pane_ConvertHighASCIICheckbox));
- ThrowIfNULL_(checkBox);
- outOptions.mConvertHighASCIIChar = (checkBox->GetValue() != 0);
-
- radioButton = dynamic_cast<LRadioButton *>(FindPaneByID(pane_NumericOutputRadioButton));
- ThrowIfNULL_(checkBox);
- outOptions.mOutputNumericTags = (checkBox->GetValue() != 0);
- }
-
-
- // ---------------------------------------------------------------------------
- // • DoExtract [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::DoExtract()
- {
- char * newBinaryImage = NULL;
- UInt32 newBinarySize;
- FILE * reportFile = NULL;
- Z_Boolean reportOK;
-
- reportFile = FSp_fopen(&mDestFileSpec.GetFSSpec(), "w");
- if (reportFile == NULL)
- {
- DisplayError("\pCould not open output file. Perhaps it is in use or locked.");
- goto CleanUpAndReturn;
- }
-
- // Process the data.
- {
- StCursor watchCursor;
-
- ZStringTool stringTool;
- ZToolOptions options;
- GetUserOptions(options);
-
- if (!ReadBinaryImage(mSourceFileSpec, newBinaryImage, newBinarySize))
- goto CleanUpAndReturn;
-
- stringTool.ProcessBinaries(newBinaryImage, newBinarySize, NULL, 0, options);
- reportOK = stringTool.PrintReport(reportFile, options);
- }
-
- if (!reportOK)
- DisplayError("\pOne or more errors occurred during the extraction. See output for details.");
- else
- DisplaySuccess("\pExtraction was successful. See destination file for results.");
-
- // Make it look like an MS IE html file.
- SetTypeAndCreator(mDestFileSpec, 'TEXT', 'MSIE');
-
- CleanUpAndReturn:
- if (reportFile != NULL)
- fclose(reportFile);
-
- delete [] newBinaryImage;
-
- UpdateFileIcons();
- }
-
-
- // ---------------------------------------------------------------------------
- // • DoCompare [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::DoCompare()
- {
- char * newBinaryImage = NULL;
- UInt32 newBinarySize;
- char * oldBinaryImage = NULL;
- UInt32 oldBinarySize;
- FILE * reportFile = NULL;
- Z_Boolean reportOK;
-
- reportFile = FSp_fopen(&mDestFileSpec.GetFSSpec(), "w");
- if (reportFile == NULL)
- {
- DisplayError("\pCould not open output file. Perhaps it is in use or locked.");
- goto CleanUpAndReturn;
- }
-
- // Process the data.
- {
- StCursor watchCursor;
-
- ZStringTool stringTool;
- ZToolOptions options;
- GetUserOptions(options);
-
- if (!ReadBinaryImage(mSourceFileSpec, newBinaryImage, newBinarySize))
- goto CleanUpAndReturn;
-
- if (!ReadBinaryImage(mCompareFileSpec, oldBinaryImage, oldBinarySize))
- goto CleanUpAndReturn;
-
- stringTool.ProcessBinaries(newBinaryImage, newBinarySize, oldBinaryImage, oldBinarySize, options);
- reportOK = stringTool.PrintReport(reportFile, options);
- }
-
- if (!reportOK)
- DisplayError("\pOne or more errors occurred during the comparison. See output for details.");
- else
- DisplaySuccess("\pComparison was successful. See destination file for results.");
-
- // Make it look like an MS IE html file.
- SetTypeAndCreator(mDestFileSpec, 'TEXT', 'MSIE');
-
- CleanUpAndReturn:
- if (reportFile != NULL)
- fclose(reportFile);
-
- delete [] newBinaryImage;
- delete [] oldBinaryImage;
-
- UpdateFileIcons();
- }
-
-
- // ---------------------------------------------------------------------------
- // • DoCreateOverride [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::DoCreateOverride()
- {
- char * overrideFileImage = NULL;
- UInt32 overrideFileSize;
- FILE * reportFile = NULL;
- Handle newResHandle = NULL;
- char * dictionary = NULL;
- UInt32 dictLength;
-
- // Determine what override ID to use.
- LEditText * editTextControl = dynamic_cast<LEditText *>(FindPaneByID(pane_LanguageResourceTextBox));
- ThrowIfNULL_(editTextControl);
- SInt16 overrideID = editTextControl->GetValue();
-
- // Process the data.
- {
- StCursor watchCursor;
-
- ZStringTool stringTool;
- ZToolOptions options;
- GetUserOptions(options);
-
- if (!ReadBinaryImage(mSourceFileSpec, overrideFileImage, overrideFileSize))
- goto CleanUpAndReturn;
-
- stringTool.ProcessBinaries(overrideFileImage, overrideFileSize, NULL, 0, options);
- stringTool.CreateOverrideDictionary(dictionary, dictLength);
- }
-
- newResHandle = ::NewHandle(dictLength);
- if (newResHandle == NULL)
- {
- DisplayError("\pOut of memory. Couldn't allocate new resource. Operation cancelled\n");
- goto CleanUpAndReturn;
- }
-
- memcpy(*newResHandle, dictionary, dictLength);
-
- // Try to open an existing file for write. If we can't,
- // we'll create a new one.
- SInt16 resFileID = ::FSpOpenResFile(&mDestFileSpec.GetFSSpec(), fsRdWrPerm);
-
- if (resFileID == -1)
- {
- ::FSpCreateResFile(&mDestFileSpec.GetFSSpec(), 'RSED', 'rsrc', 0);
-
- resFileID = ::FSpOpenResFile(&mDestFileSpec.GetFSSpec(), fsRdWrPerm);
- }
-
- if (resFileID == -1)
- {
- DisplayError("\pCould not open output file. Perhaps it is in use or locked.");
- goto CleanUpAndReturn;
- }
-
- // Remove any existing resource with the same ID.
- Handle oldDictionary = ::Get1Resource(kZStringOverrideDictionaryResType, overrideID);
- if (oldDictionary != NULL)
- ::RemoveResource(oldDictionary);
-
- // Now, add the new resource.
- ::AddResource(newResHandle, kZStringOverrideDictionaryResType, overrideID, "\p");
- ::WriteResource(newResHandle);
- ::CloseResFile(resFileID);
-
- // The resource is no longer valid because we closed the file.
- newResHandle = NULL;
-
- DisplaySuccess("\pOverride dictionary was successfully created.");
-
- CleanUpAndReturn:
- if (newResHandle != NULL)
- ::DisposeHandle(newResHandle);
-
- if (reportFile != NULL)
- fclose(reportFile);
-
- delete [] overrideFileImage;
- delete [] dictionary;
-
- UpdateFileIcons();
- }
-
-
- // ---------------------------------------------------------------------------
- // • SelectFile [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::SelectFile(
- PaneIDT inTextID,
- PaneIDT inIconID,
- MacZStringFileSpec & outFileSpec,
- Boolean inExistingFile)
- {
- FSSpec fsSpec;
- Boolean specOK;
-
- if (inExistingFile)
- {
- UConditionalDialogs::LFileChooser fileChooser;
- LFileTypeList typeList(fileTypes_All);
-
- specOK = fileChooser.AskChooseOneFile(typeList, fsSpec);
- }
- else
- {
- UConditionalDialogs::LFileDesignator fileDesignator;
- fileDesignator.SetFileCreator(FOUR_CHAR_CODE('****'));
- specOK = fileDesignator.AskDesignateFile("\pZStringOutput.html");
-
- if (specOK)
- fileDesignator.GetFileSpec(fsSpec);
- }
-
- // If the selection was OK, update the user interface
- if (specOK)
- SetFile(inTextID, inIconID, fsSpec, outFileSpec);
-
- UpdateButtonStatus();
- }
-
-
- // ---------------------------------------------------------------------------
- // • SetFile [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::SetFile(
- PaneIDT inTextID,
- PaneIDT inIconID,
- const FSSpec & inFileSpec,
- MacZStringFileSpec & outFileSpec)
- {
- outFileSpec.SetFileSpec(inFileSpec);
-
- LStaticText * staticTextItem;
- LStr255 fileName(inFileSpec.name);
-
- // Set the static text to indicate the file name
- staticTextItem = dynamic_cast<LStaticText *>(FindPaneByID(inTextID));
- ThrowIfNULL_(staticTextItem);
- staticTextItem->SetText(fileName);
- staticTextItem->Enable();
-
- // Set the icon
- FileIconPane * iconPane = dynamic_cast<FileIconPane *>(FindPaneByID(inIconID));
- ThrowIfNULL_(iconPane);
- iconPane->Enable();
-
- if (outFileSpec.GetIconRef() != NULL)
- iconPane->SetIconRef(outFileSpec.GetIconRef());
- else
- iconPane->SetIconID(icon_HTMLFileTypeIcon);
-
- UpdateButtonStatus();
- }
-
-
- // ---------------------------------------------------------------------------
- // • UpdateFileIcons [protected]
- // ---------------------------------------------------------------------------
-
- void
- MacZStringWindow::UpdateFileIcons()
- {
- // In case the creation of a file overwrote an existing file
- // or created a new one, we'll update the file icons so the icon
- // in the Finder matches our icon.
-
- if (mSourceFileSpec.IsValid())
- SetFile(pane_SourceFileNameStaticText, pane_SourceFileIcon, mSourceFileSpec.GetFSSpec(), mSourceFileSpec);
-
- if (mCompareFileSpec.IsValid())
- SetFile(pane_CompareFileNameStaticText, pane_CompareFileIcon, mCompareFileSpec.GetFSSpec(), mCompareFileSpec);
-
- if (mDestFileSpec.IsValid())
- SetFile(pane_DestFileNameStaticText, pane_DestFileIcon, mDestFileSpec.GetFSSpec(), mDestFileSpec);
- }
-
-
- /*------------------------------------------------------------------
- ReadBinaryImage
- ------------------------------------------------------------------*/
-
- Boolean
- MacZStringWindow::ReadBinaryImage(
- const FSSpec & inFileSpec,
- char * & outMemoryImage,
- UInt32 & outLength)
- {
- FSSpec theSpec = inFileSpec;
- OSErr err = noErr;
-
- // get the catalog info
- CInfoPBRec catInfo;
- {
- catInfo.hFileInfo.ioCompletion = NULL;
- catInfo.hFileInfo.ioVRefNum = inFileSpec.vRefNum;
- catInfo.hFileInfo.ioNamePtr = const_cast<StringPtr>(inFileSpec.name);
- catInfo.hFileInfo.ioFDirIndex = 0;
- catInfo.hFileInfo.ioDirID = inFileSpec.parID;
- err = ::PBGetCatInfoSync(&catInfo);
- }
- if (err != noErr)
- {
- DisplayError("\pError reading catalog info");
- return false;
- }
-
- // Allocate total memory required for binary image.
- // We allocate the combined logical lengths of both forks. Since
- // we won't be scanning the resource map or the override resources
- // this will actually be a little more memory than we need.
- outMemoryImage = new (std::nothrow) char[catInfo.hFileInfo.ioFlLgLen + catInfo.hFileInfo.ioFlRLgLen];
- if (outMemoryImage == NULL)
- {
- DisplayError("\pNot enough memory to load file.");
- return false;
- }
-
- if (catInfo.hFileInfo.ioFlAttrib & ioDirMask)
- {
- DisplayError("\pSelected item is a directory.");
- return false;
- }
-
- // Initalize read data
- Byte * outMemPtr = reinterpret_cast<Byte *>(outMemoryImage);
- outLength = 0;
-
- if (catInfo.hFileInfo.ioFlLgLen > 0) // Data fork exists?
- {
- SInt16 dfRefNum = -1;
-
- // Open the data fork
- err = ::FSpOpenDF(&theSpec, fsRdPerm, &dfRefNum);
- if (err != noErr)
- {
- DisplayError("\pError opening data fork.");
- return false;
- }
-
- // Seek the start of file (redundant)
- err = ::SetFPos(dfRefNum, fsFromStart, 0);
- if (err != noErr)
- {
- DisplayError("\pError seeking start-of-file.");
- return false;
- }
-
- // Read the entire logical data fork
- long readLength = catInfo.hFileInfo.ioFlLgLen;
- err = ::FSRead(dfRefNum, &readLength, outMemPtr);
- if (err != noErr)
- {
- DisplayError("\pError reading data fork.");
- ::FSClose(dfRefNum);
- return false;
- }
- outMemPtr += readLength;
- outLength += readLength;
-
- // Close the data fork
- ::FSClose(dfRefNum); // Error is ignored
- }
-
- if (catInfo.hFileInfo.ioFlRLgLen > 0) // Resource fork exists?
- {
- // Preserve original resource file
- SInt16 originalResFile = ::CurResFile();
- SInt16 rfRefNum = -1;
-
- // Open resource fork
- rfRefNum = ::FSpOpenResFile(&theSpec, fsRdPerm);
- if ((err = ::ResError()) != noErr)
- {
- DisplayError("\pError opening resource fork.");
- return false;
- }
-
- // Read resources
- UInt32 typeCount = ::Count1Types();
- for (UInt32 i = 1; i <= typeCount; i++) // loop through res types
- {
- ResType resType;
- ::Get1IndType(&resType, i);
-
- // Skip over override dictionary res types.
- if (resType != kZStringOverrideDictionaryResType)
- {
- UInt32 resCount = ::Count1Resources(resType);
- for (UInt32 i = 1; i <= resCount; i++) // loop through res count
- {
- // Read resource
- Handle resHandle = ::Get1IndResource(resType, i);
- if (resHandle != NULL)
- {
- Size resSize = ::GetHandleSize(resHandle);
- ::BlockMoveData(*resHandle, outMemPtr, resSize);
- outMemPtr += resSize;
- outLength += resSize;
- ::ReleaseResource(resHandle);
- }
- }
- }
- }
-
- // Close the resource fork
- ::CloseResFile(rfRefNum);
-
- // Restore original resource file
- ::UseResFile(originalResFile);
- }
-
- return true;
- }
-
-
- /*------------------------------------------------------------------
- DisplayError
- ------------------------------------------------------------------*/
-
- void
- MacZStringWindow::DisplayError(
- StringPtr inErrorString)
- {
- ::ParamText(inErrorString, "\p", "\p", "\p");
- UModalAlerts::StopAlert(ALRT_Error);
- }
-
-
- /*------------------------------------------------------------------
- DisplaySuccess
- ------------------------------------------------------------------*/
-
- void
- MacZStringWindow::DisplaySuccess(
- StringPtr inSuccessString)
- {
- ::ParamText(inSuccessString, "\p", "\p", "\p");
- UModalAlerts::NoteAlert(ALRT_Error);
- }
-
-
- // ---------------------------------------------------------------------------
- // • SetTypeAndCreator [private]
- // ---------------------------------------------------------------------------
-
- OSErr
- MacZStringWindow::SetTypeAndCreator(
- const FSSpec & inFileSpec,
- OSType inType,
- OSType inCreator)
- {
- CInfoPBRec pb;
- OSErr tempErr;
-
- memset(&pb, 0, sizeof(CInfoPBRec));
-
- pb.hFileInfo.ioVRefNum = inFileSpec.vRefNum;
- pb.hFileInfo.ioNamePtr = (StringPtr)&inFileSpec.name[0];
- pb.hFileInfo.ioDirID = inFileSpec.parID;
- pb.hFileInfo.ioFDirIndex = 0;
-
- tempErr = ::PBGetCatInfoSync(&pb);
- if (tempErr == noErr)
- {
- pb.hFileInfo.ioDirID = inFileSpec.parID;
- pb.hFileInfo.ioFlFndrInfo.fdType = inType;
- pb.hFileInfo.ioFlFndrInfo.fdCreator = inCreator;
- tempErr = ::PBSetCatInfoSync(&pb);
- }
-
- return tempErr;
- }
-
-
-